#ifndef AGENT_H
#define AGENT_H

#include <QVector3D>

#include "geometry/sphere.h"

class Flock;

class Agent
{
public:
    static const qreal s_maxVelocity        = 2.0;
    static const qreal s_minVelocity        = 0.5;
    static const qreal s_maxAngularVelocity = 0.1;
    static const qreal s_braking            = 0.1;
    static const qreal s_startProbability   = 0.5;
    static const qreal s_stopProbability    = 0.1;

    Agent(Flock& rkFlock);
    ~Agent();

    bool isActive() const;
    void setActive(bool bActive);

    QVector3D position() const;
    QVector3D velocity() const;

    void setPosition(const QVector3D& rkPosition);
    void setPosition(qreal x, qreal y, qreal z);

    void setVelocity(const QVector3D& rkVelocity);
    void setVelocity(qreal x, qreal y, qreal z);

    const Sphere& range() const;

    void* userData() const;
    void setUserData(void* pkUserData);

protected:
    Agent(const Agent&);
    Agent& operator = (const Agent&);

private:
    //---------------------------------------------------------------
    // Members.
    //---------------------------------------------------------------
    // Flocking.
    Flock&    m_rkFlock;
    bool      m_bIsActive;

    // Physics.
    QVector3D m_kVelocity;
    Sphere    m_kRange;

    // Miscellaneous.
    void*     m_pkUserData;
};

#endif // AGENT_H
